﻿<div style="padding: 1px; overflow: hidden">
    <form id="ui_dead_reserve2_form" method="post">
        <div title="预约骨灰堂" style="padding: 10px">
            <table style="width: 99%">
                <tr>                    
                    <th>死者姓名:</th>
                    <td>
                        <input type="hidden" name="ui_relative_id" id="ui_relative_id" />
                        <input type="hidden" name="ui_dead_id" id="ui_dead_id" />
                        
                        <input class="easyui-textbox" name="ui_dead_name" id="ui_dead_name" readonly="readonly" />
                    </td>                    
                </tr>
                <tr>                    
                    <th>死者证件:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_cardno" id="ui_dead_cardno" readonly="readonly" />
                    </td>                    
                </tr>
                <tr>                    
                    <th>火化时间:</th>
                    <td>
                        <input class="easyui-datetimebox" name="ui_dead_firetime" id="ui_dead_firetime" data-options="required:true" />
                    </td>
                </tr>
                <tr>
                    <th>联系人电话:</th>
                    <td>   
                         <input class="easyui-searchbox" data-options="prompt:'请输入联系电话查询',searcher:getRelativeByTel"  name="ui_relative_tel" id="ui_relative_tel" />                                 
                    </td>

                </tr>
                <tr>
                    <th>联系人姓名:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_relative_name" id="ui_relative_name" readonly="readonly"  />
                    </td>
                    
                </tr>
                <tr>                    
                    <th>与死者关系:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_relative_relation" id="ui_relative_relation" data-options="required:true" />
                    </td>
                </tr>
                
                
                <tr>
                    <th>预定骨灰堂名称:</th>
                    <td>
                        <input class="easyui-combotree" id="ui_dead_estStoreplace" name="ui_dead_estStoreplace"
                            data-options="url: 'ashx/bg_paradise.ashx?action=getall', lines:true,required:true" />                       
                    </td>
                    
                </tr>
                <tr>
                    <th>预定存灰时间:</th>
                    <td>
                        <input class="easyui-datetimebox" id="ui_dead_estStoretime" name="ui_dead_estStoretime" data-options="required:true" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
    <script>
        $(function () {
            
        });

        function getRelativeByTel(tel) {
            if (!tel) {
                $.show_warning("提示", "请输入联系人电话！");
                return;
            }
            para = {};
            para.action = "getRelativeByTel";
            para.timespan = new Date().getTime();
            para.tel = tel;
            $.ajax({
                url: "ashx/bg_relative.ashx",
                data: para,
                type: "POST",
                dataType: "json",
                success: function (data) {
                    var dr = data.msg;
                    if (data.success && dr) {
                        $('#ui_relative_id').val(dr.id);
                        $('#ui_relative_name').textbox('setValue', dr.name);
                        $('#ui_relative_tel').textbox('setValue', dr.tel);
                    } else {
                        $('#ui_relative_id').val(0);
                        $('#ui_relative_name').textbox('setValue', "");
                        if (dr) {
                            $.show_warning("提示", data.msg);
                        } else {
                            $.show_warning("提示", "联系人不存在，请先添加！");
                        }
                    }
                }
            });
        }        
    </script>
</div>
